import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import styleImport,{VantResolve} from "vite-plugin-style-import"

const path = require("path")

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    // 按需加载vant
    styleImport({
      resolves:[VantResolve()],
      libs:[
        {
          libraryName:"vant",
          esModule:true,
          // 自定义路径 官方提供的默认路径有问题
          resolveStyle:(name)=>{
            return `../es/${name}/style/index`
          }
        }
      ]
    })
  ],
  resolve:{
    // 配置路径别名
    alias :{
      "@":path.resolve(__dirname,"./src")
    }
  },
  server : {
    host : "0.0.0.0",
    port : 8080,
    https : false
  }
})
